package com.box2dwrapper.object
{
	import Box2D.Collision.Shapes.b2CircleDef;
	import Box2D.Dynamics.b2BodyDef;
	
	import com.box2dwrapper.view.core.AbstractView;
	
	import flash.display.DisplayObject;
	
	public class Circle extends AbstractObject
	{
		public static const DYNAMIC:String = "dynamic";
		public static const STATIC:String = "static";
				
		public function Circle(strType:String = "dynamic", numDensity:Number = 1.0, numFriction:Number = 0.3, numRestitution:Number = 0.2)
		{
			bodyDef = new b2BodyDef();
			circleDef = new b2CircleDef();
			
			type = strType;
			density = numDensity;
			friction = numFriction;
			restitution = numRestitution;
		}
		
		public function get radius():Number { return circleDef.radius * AbstractView.SCALE; }
		public function set radius(rad:Number):void
		{
			circleDef.radius = rad/AbstractView.SCALE;
		}
		
		public function set density(value:Number):void { circleDef.density = value }
		public function get density():Number { return circleDef.density }
		
		public function set friction(value:Number):void { circleDef.friction = value }
		public function get friction():Number { return circleDef.friction }
		
		public function set restitution(value:Number):void { circleDef.restitution = value }
		public function get restitution():Number { return circleDef.restitution }
		
		public function set type(boxType:String):void
		{
			if(boxType == "static"){
				circleDef.density = 0;
			}else if(boxType == "dynamic"){
				circleDef.density = density;
				circleDef.friction = friction;
				circleDef.restitution = restitution;
			}
		}
		
	}
}